#include "Generate_C_std.h"
#include "Pattern_assign_var.h"

class Pattern_assign_expr_foreach_get_val : public Pattern_assign_var
{
	Expr* rhs_pattern()
	{
		get_val = new Wildcard<Foreach_get_val>;
		return get_val;
	}

	void generate_code (Generate_C* gen)
	{
		if (!agn->is_ref)
			INST (buf, "assign_expr_foreach_get_val",
					lhs->value, get_val->value->array,
					get_val->value->iter->value);
		else
			INST (buf, "assign_expr_ref_foreach_get_val",
					lhs->value, get_val->value->array,
					get_val->value->iter->value);
	}

protected:
	Wildcard<Foreach_get_val>* get_val;
};


CREATE(Pattern_assign_expr_foreach_get_val)
